Splitting stems with Spleeter
I talked to Zanski about using the official stems of the track Forest Spirit Sound, but I also wanted to include the other songs of the album in this experience. Sadly these stems aren't available and it didn't want to give Zanski too much extra work, so I decided to split them myself using a tool called Spleeter.
Spleeter is a neural network tool that splits mixed audio (masters) into it's sources (stems). It allows you to train on your own dataset but also comes with pretrained models. To split the tracks of Phenomena, I used the pretrained model that splits into 5 stems up to 16kHz. The stems this produces is still nowhere close to the original stems, but it's pretty decent to get a rough cut.
Because of the modular way that I build this project, loading the stems is super easy. I just add the track to the json playlist file, add the path to the stems and then the names of the stems and color of the object. It looks like this:
{
"title": "Forest Spirit Sound",
"stemsPath": "media/audio/phenomena-spleeter/forest-spirit-sound/",
"stems": [
{
"name": "FSS-bass",
"color": "#D4FF37"
},
{
"name": "FSS-drums",
"color": "#FF1ACF"
},
{
"name": "FSS-little-sounds",
"color": "#9442FF"
},
{
"name": "FSS-guitars",
"color": "#16C9FF"
},
{
"name": "FSS-vocals",
"color": "#61FF8C"
}
],
...
And that's it! I just have to upload the stems in mp3 format and upload this updated json file and it'll be ready to use.
Wav -> mp3 #
In order to save some bandwidth, I wanted to compress the stems from wav to mp3. I used ffmpeg for this. Install ffmpeg first if you dont have it already. Spleeter gave me a ton of wav files, and I was not about to convert each one manually so I created and modified a quick script to fit my needs. This converts any .wav. files in the current folder to mp3. Since I was developing on windows, this was the resulting .bat file:
FOR /F "tokens=*" %%G IN ('dir /b *.wav') DO ffmpeg -i "%%G" -acodec mp3 "%%~nG.mp3"
You can just put this file in the same directory as the stems, double click it and it'll convert them all and then exit. I'll definitely be keeping this tool around because it's so easy to use and I could use it for my music production needs as well.